import request from '@/utils/request'
import type { ReqGetUserInfoResponseData, ReqLoginRequestParams, ReqLoginResponseData } from './interface/userInfo'

export default {
  /**
   * @description 登录
   * @url http://39.98.123.211:8170/swagger-ui.html#!/index45controller/loginUsingPOST
   * @param { password, username }: ReqLoginRequestParams
   * @returns Promise<ReqLoginResponseData>
   */
  reqLogin({ password, username }: ReqLoginRequestParams) {
    return request.post<any, ReqLoginResponseData>('/admin/acl/index/login', {
      password,
      username
    })
  },
  /**
   * @description 获取用户信息
   * @url http://39.98.123.211:8170/swagger-ui.html#!/index45controller/infoUsingGET
   * @returns Promise<ReqGetUserInfoResponseData>
   */
  reqGetUserInfo() {
    return request.get<any, ReqGetUserInfoResponseData>('/admin/acl/index/info')
  },
  /**
   * @description 退出登录
   * @url http://39.98.123.211:8170/swagger-ui.html#!/index45controller/logoutUsingPOST
   * @returns Promise<any>
   */
  reqLoginout() {
    return request.post('/admin/acl/index/logout')
  }
}
